<h3>About You</h3>
<?php
if ($p == "login"){
echo "Login to see this information!";
}else{

$sidebarmsg = new xmlrpcmsg('atheme.command');
				$sidebarmsg->addParam(new xmlrpcval($authcookie, $xmlrpcString));
				$sidebarmsg->addParam(new xmlrpcval($uname, $xmlrpcString));
				$sidebarmsg->addParam(new xmlrpcval(".", $xmlrpcString));
				$sidebarmsg->addParam(new xmlrpcval("NickServ", $xmlrpcString));
				$sidebarmsg->addParam(new xmlrpcval("INFO", $xmlrpcString));
				$sidebarmsg->addParam(new xmlrpcval($uname, $xmlrpcString));
			$client = new xmlrpc_client(PATH, HOST, PORT);
			$sidebarresponse = $client->send($sidebarmsg);
//$sidebarinfo = XML2Array ( $sidebarresponse->serialize(), True );
//$sidebaroutput = $sidebarinfo[0];

$unserialsidebar = unserialize_xml($sidebarresponse->serialize());
$sidedata = $unserialsidebar['params']['param']['value']['string'];
//print_r($sidedata);
echo "<ul>";
//$sideoutput = preg_replace('/Registered :/', '<li><b>Registered:</b>', $sidedata);
//$sideoutput = preg_replace('/Last addr :/', '</li><li><b>Last addr:</b>', $sideoutput);

$patterns = array();
$patterns[0] = '/Registered :/';
$patterns[1] = '/Last addr  :/';
$patterns[2] = '/vHost      :/';
$patterns[3] = '/Real addr  :/';
$patterns[4] = '/Last seen  :/';
$patterns[5] = '/User seen  :/';
$patterns[6] = '/Logins from:/';
$patterns[7] = '/Nicks      :/';
$patterns[8] = '/Email      :/';
$patterns[9] = '/Flags      :/';
$patterns[10] = '/Oper class :/';
$patterns[11] = '/Channels   :/';
$patterns[12] = '/\*\*\* End of Info \*\*\*/';
$replacements = array();
$replacements[12] = '<li><b>Registered:</b>';
$replacements[11] = '</li><li><b>Last addr:</b>';
$replacements[10] = '</li><li><b>vHost:</b>';
$replacements[9] = '</li><li><b>Real addr:</b>';
$replacements[8] = '</li><li><b>Last seen:</b>';
$replacements[7] = '</li><li><b>User seen:</b>';
$replacements[6] = '</li><li><b>Logins from:</b>';
$replacements[5] = '</li><li><b>Nicks:</b>';
$replacements[4] = '</li><li><b>Email:</b>';
$replacements[3] = '</li><li><b>Flags:</b>';
$replacements[2] = '</li><li><b>Oper class:</b>';
$replacements[1] = '</li><li><b>Channels:</b>';
$replacements[0] = '</ul>';
echo preg_replace($patterns, $replacements, $sidedata);
//preg_match('/[Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sept|Nov|Dec].[0-9]\(0-9]|[ago]\)/', $sidedata, $udatar);
//print_r($udatar);
//echo $unserial['string'];
//$sidebarxml = simplexml_load_string($sidebarresponse->serialize());
//var_dump($sidebarxml);
//echo $sidebarxml->String;
//echo $sidebaroutput;
	if($sidebarresponse->faultCode()) {
				printf('<h3>Fault</h3>');
				printf('Fault code: %d<br>', htmlentities($sidebarresponse->faultCode()));
				printf('Fault string: %s', htmlentities($sidebarresponse->faultString()));

				}
?>
<h3>Logout</h3>
<form action="<?=$_SERVER['PHP_SELF'];?>" method="post">
<input type="submit" name="logout" value="Logout">
</form>
				<?php
				} 
?>
